#!/bin/sh
# Busybox udhcpc4 service discovery script.

#
# Based on the busybox example scripts
# Copyright (C) 2009 by Axel Beckert.
#

#  Copyright (C) 2014 Curt Brune <curt@cumulusnetworks.com>
#
#  SPDX-License-Identifier:     GPL-2.0

PROG="DHCP"

case $1 in
    bound|renew)

        # Print responses usable by onie, prefixed with "onie_disco"
        # Translate '=' into '@', e.g. name=val => name@@val
        # Separate name@val pairs with '##'
        onie_parms=$(printenv | sed -e '/.*=$/d' -e '/^[A-Z_]/d' -e '/^onie.*/d' -e 's/=/@@/' -e 's/$/#/' -e 's/^/onie_disco_/' | tr '\n' '#')
        echo "ONIE_PARMS:$onie_parms"

        ;;

    *)
        ;;
esac
